<!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>结构伪类</title>
    <style type="text/css">
        .wrapper {
            width: 80%;
            border: 1px solid blue;
            margin: 25px auto;
        }
        
        .wrapper>* {
            height: 20px;
            border: 1px solid green;
            margin: 10px;
        }
        
        .inner:nth-child(1) {
            background: #ff0;
        }
        
        .inner:nth-last-child(1) {
            background: #9696ff;
        }
        
        .third div:nth-last-child(6) {
            color: red;
        }
        
        .third div:nth-last-child(n+3) {
            text-align: right;
        }
    </style>
</head>

<body>

    <div class="wrapper first">
        <!-- 匹配 .inner:nth-child(1)-->
        <div class="inner">甲子</div>
        <p class="inner">乙丑</p>
        <div class="inner">丙寅</div>
        <!-- 匹配 .inner:nth-last-child(1)-->
        <p class="inner"></p>
    </div>

    <div class="wrapper second">
        <!-- 匹配 .inner:nth-child(1)-->
        <div class="inner">丁卯</div>
        <p class="inner">戊辰</p>
        <div class="inner">庚子</div>
        <!-- 匹配 .inner:nth-last-child(1)-->
        <p class="inner">辛丑</p>
    </div>

    <div class="wrapper third">
        <div class="inner">第1块</div>
        <div class="inner">第2块</div>
        <div class="inner">第3块</div>
        <div class="inner">第4块</div>
        <div class="inner">第5块</div>
        <div class="inner">第6块</div>
        <div class="inner">第7块</div>
        <div class="inner">第8块</div>
        <div class="inner">第9块</div>
        <div class="inner">第10块</div>
    </div>


</body>

</html>